import { deleteApi, get, post, put } from '@/utils/http.js'
import type { MenuType } from '@/views/desktop/type/index.ts'

const api = {
  menuList: '/desktop/menu/list',
  insert: '/desktop/menu/insert',
  update: '/desktop/menu/update',
  deleteById: '/desktop/menu/delete/',
  setMenuPosition: '/desktop/menu/update',
  tidyUp: '/desktop/menu/update/tidyUp',
}

export const insert = (params) => {
  return post(api.insert, params)
}

export const update = (params) => {
  return put(api.update, params)
}

export const deleteById = (id: string) => {
  return deleteApi(api.deleteById + id, null)
}

export const getMenuList = (params) => {
  return post(api.menuList, params)
}

export const setMenuPosition = (params) => {
  return put(api.setMenuPosition, params)
}

export const tidyUp = () => {
  return put(api.tidyUp, null)
}
